package com.style_transfer.controller;

import com.style_transfer.model.Image;
import com.style_transfer.model.Location;
import com.style_transfer.service.impl.ImageServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("image")
public class ImageController {
    @Autowired
    private ImageServiceImpl imageService;

    @ResponseBody
    @GetMapping("/getImageByID/{im_id}")
    public Image getImageByID(@PathVariable int im_id){
        return imageService.getImageByID(im_id);
    }

    @ResponseBody
    @GetMapping("/getVideoByID/{im_id}")
    public Image getVideoByID(@PathVariable int im_id){
        return imageService.getVideoByID(im_id);
    }

    @ResponseBody
    @GetMapping("/getImage")
    public Image getImage(@RequestBody Location location){
        return imageService.getImage(location);
    }

    @ResponseBody
    @GetMapping("/getVideo")
    public Image getVideo(@RequestBody Location location){
        return imageService.getVideo(location);
    }

    @ResponseBody
    @GetMapping("/getImageByName/{l_name}")
    public List<Image> getImageByName(@PathVariable String l_name){
        return imageService.getImageByName(l_name);
    }

    @ResponseBody
    @GetMapping("/getAllImage")
    public List<Image> getAllImage(){
        return imageService.getAllImage();
    }

    @ResponseBody
    @GetMapping("/getAllVideo")
    public List<Image> getAllVideo(){
        return imageService.getAllVideo();
    }
}
